package com.lzh.lzhframework.domain.entity.mongo;

import com.lzh.lzhframework.domain.entity.FeedbackEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.Date;

/**
 * 用户反馈信息
 *
 * @Author luzhiheng
 * @Date 2023/12/10 16:57
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document("admin_reply")
public class AdminReplyEntity {

    /**
     * 主键 _id
     */
    @Id
    private String id;

    /**
     * 反馈用户
     */
    @Field("user_name")
    private String userName;

    /**
     * 是否已读 0未读 1已读
     */
    @Field("is_read")
    private Boolean isRead;

    /**
     * 反馈信息id
     */
    @Field("feedback_id")
    private Long feedbackId;

    /**
     * 创建时间
     */
    @Field("create_time")
    private Date createTime;

    public AdminReplyEntity(FeedbackEntity feedbackEntity) {
        this.setFeedbackId(feedbackEntity.getId());
        this.setCreateTime(new Date());
        this.setUserName(feedbackEntity.getCreateName());
        this.setIsRead(false);
    }
}
